﻿using TagCloudSoma;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using System.Threading;
using System.Globalization;


namespace TestTagCloud
{
 
    /// <summary>
    ///This is a test class for TagCloudTest and is intended
    ///to contain all TagCloudTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TagCloudTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        /// <summary>
        ///A test for wordCounter
        ///</summary>
        [TestMethod()]
        public void wordCounterTest()
        {
            string s = "To be, or not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them";
            TagCloud target = new TagCloud(); 
            int num = 1; 

            KeyValuePair<string,int> expected = new KeyValuePair<string,int>("to",4); // TODO: Initialize to an appropriate value
            Dictionary<string, int> myDictionary;
            myDictionary = target.wordCounter(s, num);
            KeyValuePair<string, int> actual = new KeyValuePair<string,int>();

            foreach (KeyValuePair<string, int> entry in myDictionary) actual = entry;

            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for cleaner
        ///</summary>
        [TestMethod()]
        public void cleanerTest()
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("es-ES");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-ES");

            string s = "Hello, World!!!!";
            TagCloud target = new TagCloud(); // TODO: Initialize to an appropriate value
            string expected = "Hello World"; // TODO: Initialize to an appropriate value
            string actual;

            actual = target.cleaner(s);

            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for stripHTMLTag
        ///</summary>
        [TestMethod()]
        public void stripHTMLTagTest()
        {
            string source = "<script>Malware</script><html>Hello World</html>";
            TagCloud target = new TagCloud(); // TODO: Initialize to an appropriate value
            string expected = "Hello World"; // TODO: Initialize to an appropriate value
            string actual;

            actual = target.stripHTMLTag(source);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for GetSource
        ///</summary>
        [TestMethod()]
        public void GetSourceTest()
        {
            TagCloud target = new TagCloud(); // TODO: Initialize to an appropriate value
            string uri = "http://www.google.com";
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            string actual;
            actual = target.GetSource(uri);

            Assert.AreNotEqual(actual,expected);
        }
    }
}
